/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sicop.entidades;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Leo
 */
@Entity
@Table(name = "obras", catalog = "sicop", schema = "")
@NamedQueries({
    @NamedQuery(name = "Obras.findAll", query = "SELECT o FROM Obras o"),
    @NamedQuery(name = "Obras.findByIdExpediente", query = "SELECT o FROM Obras o WHERE o.idExpediente = :idExpediente"),
    @NamedQuery(name = "Obras.findByDuracion", query = "SELECT o FROM Obras o WHERE o.duracion = :duracion"),
    @NamedQuery(name = "Obras.findByMontoTotal", query = "SELECT o FROM Obras o WHERE o.montoTotal = :montoTotal"),
    @NamedQuery(name = "Obras.findByUbicacion", query = "SELECT o FROM Obras o WHERE o.ubicacion = :ubicacion")})
public class Obras implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IdExpediente", nullable = false, length = 16)
    private String idExpediente;
    @Column(name = "Duracion", length = 10)
    private String duracion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "MontoTotal", precision = 10, scale = 2)
    private BigDecimal montoTotal;
    @Column(name = "Ubicacion", length = 50)
    private String ubicacion;
    @JoinColumn(name = "IdFuente", referencedColumnName = "IdFuente")
    @ManyToOne
    private Fuentefinanciamiento idFuente;
    @JoinColumn(name = "IdTipoContrato", referencedColumnName = "Idtipocontrato")
    @ManyToOne
    private Tipocontrato idTipoContrato;
    @JoinColumn(name = "IdContratista", referencedColumnName = "Idcontratista")
    @ManyToOne
    private Contratista idContratista;
    @JoinColumn(name = "IdEstado", referencedColumnName = "IdEstado")
    @ManyToOne
    private Estadoobra idEstado;
    @JoinColumn(name = "IdProgramacion", referencedColumnName = "IdProgramacion", nullable = false)
    @ManyToOne(optional = false)
    private Programacion idProgramacion;

    public Obras() {
    }

    public Obras(String idExpediente) {
        this.idExpediente = idExpediente;
    }

    public String getIdExpediente() {
        return idExpediente;
    }

    public void setIdExpediente(String idExpediente) {
        this.idExpediente = idExpediente;
    }

    public String getDuracion() {
        return duracion;
    }

    public void setDuracion(String duracion) {
        this.duracion = duracion;
    }

    public BigDecimal getMontoTotal() {
        return montoTotal;
    }

    public void setMontoTotal(BigDecimal montoTotal) {
        this.montoTotal = montoTotal;
    }

    public String getUbicacion() {
        return ubicacion;
    }

    public void setUbicacion(String ubicacion) {
        this.ubicacion = ubicacion;
    }

    public Fuentefinanciamiento getIdFuente() {
        return idFuente;
    }

    public void setIdFuente(Fuentefinanciamiento idFuente) {
        this.idFuente = idFuente;
    }

    public Tipocontrato getIdTipoContrato() {
        return idTipoContrato;
    }

    public void setIdTipoContrato(Tipocontrato idTipoContrato) {
        this.idTipoContrato = idTipoContrato;
    }

    public Contratista getIdContratista() {
        return idContratista;
    }

    public void setIdContratista(Contratista idContratista) {
        this.idContratista = idContratista;
    }

    public Estadoobra getIdEstado() {
        return idEstado;
    }

    public void setIdEstado(Estadoobra idEstado) {
        this.idEstado = idEstado;
    }

    public Programacion getIdProgramacion() {
        return idProgramacion;
    }

    public void setIdProgramacion(Programacion idProgramacion) {
        this.idProgramacion = idProgramacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idExpediente != null ? idExpediente.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Obras)) {
            return false;
        }
        Obras other = (Obras) object;
        if ((this.idExpediente == null && other.idExpediente != null) || (this.idExpediente != null && !this.idExpediente.equals(other.idExpediente))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.sicop.entidades.Obras[ idExpediente=" + idExpediente + " ]";
    }
    
}
